<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2017/11/28 0028
  Time: 上午 9:54
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>编辑黑名单</title>
    <style>
        .layui-btn{
            position: relative;
            top:50px;
            left:100px;
        }
    </style>
    <link rel="stylesheet" href="/static/plugins/layui/css/layui.css">
</head>
<body>
<div class="box-padding-15">
         <span class="layui-breadcrumb">
          <a href="#">首页</a>
          <a href="javascript:;">黑名单管理</a>
          <a><cite>增加</cite></a>
        </span>
    <hr>
<form class="layui-form" action="/black/update" method="get">
    <div class="layui-form-item">
        <label class="layui-form-label">真实姓名:</label>
        <div class="layui-input-block">
            <input type="text" name="name" lay-verify="required" placeholder="请输入真实姓名" autocomplete="off"
                   class="layui-input" value="${blackClient.name}">
            <input type="hidden" name="id" value="${blackClient.id}">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">手机号码:</label>
        <div class="layui-input-block">
            <input type="text" name="mobile" lay-verify="required|phone" placeholder="请输入11位手机号" autocomplete="off"
                   class="layui-input" value="${blackClient.mobile}">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">身份证号:</label>
        <div class="layui-input-block">
            <input type="text" name="idCard" lay-verify="required|identity" placeholder="请输入身份证号" autocomplete="off"
                   class="layui-input" value="${blackClient.idCard}">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">原因类型:</label>
        <div class="layui-input-block">
            <select name="reasonType" lay-verify="required" >
                <option value="">请选择</option>
                <option <c:if test="${blackClient.reasonType==1}">selected</c:if> value="1">偷盗惯犯 </option>
                <option <c:if test="${blackClient.reasonType==2}">selected</c:if> value="2">租车老赖</option>
                <option <c:if test="${blackClient.reasonType==3}">selected</c:if> value="3">酒后驾驶</option>
            </select>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">来源类型:</label>
        <div class="layui-input-block">
            <select name="sourceType" lay-verify="required">
                <option value="">请选择</option>
                <option <c:if test="${blackClient.sourceType==1}">selected</c:if> value="1">人工识别</option>
                <option <c:if test="${blackClient.sourceType==2}">selected</c:if> value="2">公安局接口</option>
                <option <c:if test="${blackClient.sourceType==3}">selected</c:if> value="3">政信通</option>
                <option <c:if test="${blackClient.sourceType==4}">selected</c:if> value="4">芝麻信用</option>
            </select>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">备注:</label>
        <div class="layui-input-block">
            <input type="text" name="remark" placeholder="请输入" autocomplete="off"
                   class="layui-input" value="${blackClient.remark}">
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">保存</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>

</div>

<script src="/static/plugins/jquery-3.2.1.min.js"></script>
<script src="/static/plugins/layui/layui.js"></script>
<script>
    layui.use(['element','form'], function () {
        var form = layui.form;
        var element = layui.element;

        form.on("submit(formDemo)",function (data) {
            $.ajax({
                url:'/black/updateAjax',
                data:data.field,  //表单所有字段
                type:'get',
                dataType:'json',
                success:function (msg) {
                    if(msg.code == 1) {
                        layer.msg(msg.message, {time: 1000, icon: 1}, function () {
                            var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                            parent.$("#tb_client").bootstrapTable("refresh"); // 刷新表格数据
                            parent.layer.close(index); //再执行关闭
                        })
                    }
                }
            })
            return false;
        })


    });
</script>
</body>
</html>
